package hotel.quartz.oversea.job.switchs;

import hotel.base.oversea.constant.CommonUrlConstants;
import hotel.base.oversea.constant.SwitchConstants;
import hotel.base.oversea.constant.quartz.UrlSwitchsEnums;
import hotel.base.oversea.utils.RestTemplateUtils;
import hotel.base.oversea.utils.Result;
import hotel.quartz.oversea.job.base.BaseJob;
import hotel.quartz.oversea.service.JobAndTriggerService;
import lombok.extern.slf4j.Slf4j;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.client.RestTemplate;

/**
 * @Auther: lmf
 * @Date: 2020/12/31/16:42
 * @Description:
 */
@Slf4j
public class SwitchBookTimeDownHotelJob implements BaseJob {
    //任务分组
    private String jobGroupName= SwitchConstants.JOB_GROUP_NAME_SWITCHS;
    //类名
    private String jobClassName=this.getClass().getName();

    @Autowired
    private JobAndTriggerService jobAndTriggerService;
    @Autowired
    private RestTemplate restTemplate;



    /***
     * @Author: lmf
     * @Date: 2020/12/28
     * 定点停售没有订单的酒店
     */
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        log.info("==================进入定点停售没有订单的酒店=============================");
        String host = CommonUrlConstants.SWITCHS_ONLINE_HOST;
        String hotelMethodGetUrl = host + UrlSwitchsEnums.SwitchCheckHotelRoomIsCreateJob.SWITCH_BOOK_TIME_CLOSE_NO_ORDER_HOTEL_LIST.getValue();
        Result result= RestTemplateUtils.get(hotelMethodGetUrl,null,restTemplate);
        log.info("==========返回结果为{}===========",result.toString());


    }
}
